<?php

    namespace PHPK;

    class Ping {

	/**
	 * Array containing attributes of Ping
	 * @var array $_arPing
	 */
	private $_arPing = array();

	/**
	 * Magic method invoking constructor of Ping
	 * @method __construct
	 * @param string $strDomain Domain to be pinged
	 */
    	public function __construct( $strDomain ) {

            if ( checkdnsrr( $strDomain ) )
	        $this->_arPing[ 'connected' ] = true;

            else
	        $this->_arPing[ 'connected' ] = false;

    	}

	/**
	 * Magic method retrieving properties of Ping
	 * @method __get
	 * @param string $strKey Key identifing an attribute of Ping
	 * @return mixed Value of the attribute identified by Key
	 */
	public function __get( $strKey ) {

	    if ( isset( $this->_arPing[ $strKey ] ) )
		return $this->_arPing[ $strKey ];

	    return false;

	}

    }

?>
